package com.jic.manager.service;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.common.base.vo.RestResult;
import com.jic.manager.entity.SysDept;
import com.jic.manager.entity.SysUserDept;
import com.jic.manager.request.*;
import com.jic.manager.request.orgcenter.SysDeptTreeRequest;
import com.jic.manager.response.MemMerchantInfoResponse;
import com.jic.manager.response.MemStoreResponse;
import com.jic.manager.response.MerchantResponse;
import com.jic.manager.response.SysDeptResponse;

import java.util.List;

/**
 * 部门信息表
 * @author :
 * @email :
 * @since : 2020-02-26 09:39:35
 * @version : v1.0.0
 */
public interface SysDeptService {

    long insert(SysDept sysDept);

    long delete(Long id);

    long update(SysDept sysDept);

    SysDept queryByPrimaryKey(Long id);

    List<SysDept> query(SysDept sysDept);

    PageResult<SysDept> queryPage(SysDept sysDept, Page pageQuery);

    RestResult<List<SysDeptResponse>> findDeptTree(SysDept sysDept);

    RestResult<String> editDeptInfo(SysDept sysDept);

    RestResult<String> deleteDept(String ids);

    /*
     * 新增机构 返回新增的id
     * */
    Long insertSysDept(SysDept sysDept);

    RestResult<Boolean> saveDeptList(SaveDeptListRequest saveDeptListRequest);

    Boolean saveDeptListStore(SaveDeptListRequest saveDeptListRequest);

    RestResult<List<Long>> getUccUserAuthor(SysUserDept sysUserDept);

    RestResult<List<Long>> getChilderByPid(SysDept sysDept);

    RestResult<Boolean> updateUserAuthor(UserAuthorRequest uccUserAuthorRequest);

    RestResult<Boolean> updateDeptName(UpdateDeptNameRequest updateDeptNameRequest);

    RestResult<List<SysDeptResponse>> getAuthorDeptTree(SysDeptTreeRequest sysDeptTreeRequest);

    RestResult<List<SysDeptResponse>> getChildeListrByPid(Long deptId);

    /**
     * 启用 停用子平台下的账号
     * @param childId 子平台id
     * @param status 0 停用 1 启用
     * @return true 成功 false 失败
     */
    Boolean updateChildUserAllStatus(Long childId, Integer status);


    RestResult<String> queryDeptNameById(Long deptId);

    List<Long> queryChildListById(Long deptId);

    RestResult<Long> updateMerchantScopeApplicationById(MerchantRequest merchantRequest);

    MemMerchantInfoResponse getGrowhtScopeInfo(Long merchantId);

    RestResult<String> queryChildNameById(Long deptId);


    /*通过商家或店铺名称查询deptId*/
    RestResult<Long> getDeptIdByMsName(String msName);

    RestResult checkApplication(Long deptId);

    List<Long> querymMerchantOrStoreListById(Long deptId);


    /*通过商家或店铺deptId 查询所属子平台deptId*/
    Long getDeptIdByMsId(SysDeptRequest sysDept);

    List<Long> querymMerchantOrStoreListByName(String name);

    //查询 商家、店铺的所属子平台
    RestResult<String> queryChildNameByDeptId(ChildNameRequest childNameRequest);

    List<SysDeptResponse> getUserProviderAuthorDept(Long userId, Long deptId);

    RestResult<List<SysDeptResponse>> getDeptList(SysDeptTreeRequest sysDeptTreeRequest);

    List<Long> queryDeptIdListByUserId(Long id);

    RestResult<MemStoreResponse> getStoreInfoByDeptId(Long id);

    List<Long> getDeptIdsByStroreIdOrMerchantIdAndType(List<Long> businessIds, Integer deptType);

    RestResult<MerchantResponse> getMerchantByDeptId(Long Id);

  SysDept getByIdPid(Long id);
}